<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>用户订单列表页面</title>
</head>
<?php 
include_once("inc.php");
include_once("base.php");
$tb_name = "orders";
$where_sql = "userid=".$_SESSION["id"];
include_once ROOT_PATH."/common/where.php";
$list = db_get_page("select * from $tb_name where $where_sql order by id desc", $page,12);
include_once ROOT_PATH."/common/page.php";
?>
<script type="text/javascript">
	function printpage(){
		window.print()
	}
</script>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" rowspan="2" valign="top" bgcolor="#FFFFFF"></td>
			<td valign="top">
				<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
					<tr bgcolor="#FFFFFF">
						<td height="31">
							<div class="title">订单列表</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="16" rowspan="2" bgcolor="#FFFFFF"></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#F7F8F9">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4" height="10"></td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<table width="100%" class="cont">
								<tr>
									<td>
										<form id="pagerForm" action="?" method="post">
											<input type="text" name="onumber" class="text" value="<?php echo $_REQUEST["onumber"]; ?>"  placeholder="输入订单编号"/>
											<button type="submit"  id="chaxun" class="btn">查询</button>
										</form>
									</td>
								</tr>
							</table>
						</td>
						<td width="1%">&nbsp;</td>
					</tr>
					<form action="?" method="post" name="lsm" id="lsm">
						<input type="hidden" name="chk" value="ok" />
						<tr>
							<td width="1%">&nbsp;</td>
							<td width="96%">
								<table width="100%">
									<td colspan="2">
										<table width="100%"  class="cont tr_color">
											<tr>
												<th>订单号</th>
												<th>姓名</th>
												<th>金额总计</th>
												<th>订单状态</th>
												<th width="150">时间</th>
												<th width="120">操作</th>
											</tr>
											<?php
											foreach($list["data"] as $row) {
												?>
												<tr align="center" class="d">
													<td><?php echo $row['onumber'];?></td>
													<td><?php echo $row['nickname'];?></td>
													<td><?php echo $row['total'];?></td>
													<td><?php echo $row['zt'];?></td>
													<td><?php echo $row['addtime'];?></td>
													<td>
														<a href="<?php echo $tb_name;?>_edit.php?id=<?php echo $row['id'];?>">查看</a> 
														<a href="?id=<?php echo $row['id'];?>&act=del" onclick='return confirm("真的要删除?不可恢复!");'>删除</a>
													</td>
												</tr>
											<?php } ?>
										</table>
									</td>
									<!-- </tr> -->
								</table>
								<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
									<tr>
										<td align="center"><?php echo $page_show;?></td>
									</tr>
								</table>    
							</td>
							<td width="1%">&nbsp;</td>
						</tr>
						<tr><td height="20"></td></tr>
					</form>
				</table>
			</td>
		</tr>
	</table>
	<?php
	if ($_REQUEST["act"]=="del") {
		db_del($tb_name,$_REQUEST["id"]);
		db_dela("ordersta","ordersid=".$_REQUEST["id"]);
		urlMsg("10操作成功", $tb_name."_list.php");
	}
	?>
</body>
</html>